<?php namespace Admin\Model;
use Hdphp\Model\Model;
class TypeAttribute extends Model{
	protected $table = "type_attribute";
	//验证
	protected $validate = array(
		array('taname','required','属性名不能为空',3,3),
		array('class','required','请选择属性类别',3,3),
		array('tavalue','required','属性值不能为空',3,3)
	);
	//添加
	public function store(){
		//触发自动验证
		if(!$this->create()) return false;
		//添加并返回
		return $this->add();
	}
	//删除
	public function del($tid){
		$this->where("taid={$tid}")->delete();
		return true;
	}
	
	//编辑
	public function edit(){

		if($this->create()){
			$this->save();
			return true;
		}
		return false;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}



?>